<template>
	<z-paging ref="paging" v-model="list" @query="getList" loading-more-default-text="我也是有底线的哦">
		<view class="h100 " :class="{mainBg:!isEdit}">
			<navbar title="私人定制" :isDefault="isEdit">
				<text @click="isEdit=true" v-if="!isEdit">编辑</text>
				<text @click="isEdit=false" v-else>完成</text>
			</navbar>
			<view class="list">
				<view v-for="item,index in list" :key="item.id">
					<checkbox-group @change="handleChange">
						<label>
							<edit v-show="isEdit" />
						</label>
					</checkbox-group>
					<item :item="item" v-show="!isEdit" />
				</view>
			</view>

			<view class="operate" v-if="isEdit">
				<view class="allBtn btn">
					<label>
						<checkbox value="cb" />全选
					</label>
				</view>
				<view class="delBtn btn" @click="handleDel"> 确定删除

				</view>
			</view>
			<view class="seat" v-if="isEdit">

			</view>
		</view>
	</z-paging>
</template>

<script>
	import item from "./components/userItemCustom.vue"
	import edit from "./components/edit.vue"
	export default {
		components: {
			item,
			edit
		},
		data() {
			return {
				list: [],
				courseType:'custom',
				isEdit: false
			}
		},
		methods: {
			getList(pageNo, pageSize) {
				const params = {
					courseType:this.courseType,
					pageNum: pageNo,
					pageSize:pageSize
				}
				this.$post("/user/courseList", JSON.stringify(params)).then(res => {
					//请勿在网络请求回调中给dataList赋值！！只需要调用complete就可以了
					this.$refs.paging.complete(res.data.rows);
				})
			},
			handleChange(e) {
				console.log(e.detail.value)
			},
			handleDel() {
				this.$model("确定删除选中的课程吗？").then(() => {
					console.log(111)
				})
			}
		}
	}
</script>

<style lang="scss">
	.h100 {
		height: 100vh;
	}

	.mainBg {
		background-color: #35CBAD;
	}

	.navBar text {
		font-size: 28rpx;
	}

	.operate {
		position: fixed;
		height: 110rpx;
		width: 100%;
		left: 0%;
		bottom: 0;
		background-color: #fff;
		z-index: 9;
		display: flex;

		.btn {
			flex: 1;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.allBtn {}

		.delBtn {
			flex: 1;
			color: $assist-color2;
		}
	}

	.seat {
		height: 110rpx;
	}

	::v-deep uni-checkbox .uni-checkbox-input {
		border-radius: 50%;
	}

	::v-deep uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked:before {
		color: #fff;
	}

	::v-deep uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
		background-color: #51C76C;
		border-color: #51C76C;
	}
</style>